package com.zzxx.mapper;

import com.zzxx.entity.Manager;
import com.zzxx.entity.ManagerExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface ManagerMapper {
    @SelectProvider(type=ManagerSqlProvider.class, method="countByExample")
    long countByExample(ManagerExample example);

    @DeleteProvider(type=ManagerSqlProvider.class, method="deleteByExample")
    int deleteByExample(ManagerExample example);

    @Delete({
        "delete from manager",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    @Insert({
        "insert into manager (id, managerName, ",
        "password, phoneNum, ",
        "introduce, src)",
        "values (#{id,jdbcType=VARCHAR}, #{managername,jdbcType=VARCHAR}, ",
        "#{password,jdbcType=VARCHAR}, #{phonenum,jdbcType=VARCHAR}, ",
        "#{introduce,jdbcType=VARCHAR}, #{src,jdbcType=VARCHAR})"
    })
    int insert(Manager row);

    @InsertProvider(type=ManagerSqlProvider.class, method="insertSelective")
    int insertSelective(Manager row);

    @SelectProvider(type=ManagerSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="managerName", property="managername", jdbcType=JdbcType.VARCHAR),
        @Result(column="password", property="password", jdbcType=JdbcType.VARCHAR),
        @Result(column="phoneNum", property="phonenum", jdbcType=JdbcType.VARCHAR),
        @Result(column="introduce", property="introduce", jdbcType=JdbcType.VARCHAR),
        @Result(column="src", property="src", jdbcType=JdbcType.VARCHAR)
    })
    List<Manager> selectByExample(ManagerExample example);

    @Select({
        "select",
        "id, managerName, password, phoneNum, introduce, src",
        "from manager",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="managerName", property="managername", jdbcType=JdbcType.VARCHAR),
        @Result(column="password", property="password", jdbcType=JdbcType.VARCHAR),
        @Result(column="phoneNum", property="phonenum", jdbcType=JdbcType.VARCHAR),
        @Result(column="introduce", property="introduce", jdbcType=JdbcType.VARCHAR),
        @Result(column="src", property="src", jdbcType=JdbcType.VARCHAR)
    })
    Manager selectByPrimaryKey(String id);

    @UpdateProvider(type=ManagerSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("row") Manager row, @Param("example") ManagerExample example);

    @UpdateProvider(type=ManagerSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("row") Manager row, @Param("example") ManagerExample example);

    @UpdateProvider(type=ManagerSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Manager row);

    @Update({
        "update manager",
        "set managerName = #{managername,jdbcType=VARCHAR},",
          "password = #{password,jdbcType=VARCHAR},",
          "phoneNum = #{phonenum,jdbcType=VARCHAR},",
          "introduce = #{introduce,jdbcType=VARCHAR},",
          "src = #{src,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(Manager row);
}